
let id;
window.onload = function () {
    id = getQuery("id");
    fullTable(1);
}
function fullTable(pageNO) {
    axios.get("/theme/findByItem",{
        params:{
            pageNO:pageNO,
            channelId:id,
            name:$("search-name").value,
            username:$("search-nickname").value,
            startDate:$("search-startDate").value,
            endDate:$("search-endDate").value
        }
    }).then(resp => {
        let info = resp.data;

        let str = "";

        info.list.forEach(n => {
            str += `<tr><td><a href="/theme.html?themeId=${n.id}">${n.name}</a></td>
                        <td>${n.user.nickname}</td>
                        <td>${n.commentNum}</td>
                        <td>${n.date}</td>
                    <tr>`;
        });

        $("data").innerHTML = str;

        let cutStr = "";
        for (let i = 1; i <=info.totalPage ; i++) {
            cutStr += `<a style="margin-left: 10px" href="javascript:fullTable(${i})">${i}</a>`;
        }
        $("cutBox").innerHTML = cutStr;
    });
}

function goSpeak() {
    location.href = "/speak.html?id=" + id;
}

function add() {
    axios.get().then();

}
